//
//  PlayController.m
//  RentTable
//
//  Created by mac on 2024/11/28.
//

#import "PlayController.h"
#import "PlayDetailController.h"

@interface PlayController ()

@property (nonatomic, strong) UIButton *billaidButton;
@property (nonatomic, strong) UIButton *nineBallsButton;
@property (nonatomic, strong) UIButton *middleEightButton;

@end

@implementation PlayController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setUI];
}

- (void)setUI {
    UIImageView *playImageView = [UIImageView new];
    [playImageView setUserInteractionEnabled:true];
    playImageView.image = [UIImage imageNamed:@"玩法-bg"];
    [self.view addSubview:playImageView];
    [playImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
    
    self.billaidButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.billaidButton setBackgroundImage:[UIImage imageNamed:@"斯诺克"] forState:UIControlStateNormal];
    [self.billaidButton addTarget:self action:@selector(billaidButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [playImageView addSubview:self.billaidButton];
    [self.billaidButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(257 * scaleH);
        make.centerX.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(343 * scaleW, 125 * scaleH));
    }];
    
    self.nineBallsButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.nineBallsButton setBackgroundImage:[UIImage imageNamed:@"九球"] forState:UIControlStateNormal];
    [self.nineBallsButton addTarget:self action:@selector(nineBallsButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [playImageView addSubview:self.nineBallsButton];
    [self.nineBallsButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.billaidButton.mas_bottom).offset(20 * scaleH);
        make.centerX.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(343 * scaleW, 125 * scaleH));
    }];
    
    self.middleEightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.middleEightButton setBackgroundImage:[UIImage imageNamed:@"中八"] forState:UIControlStateNormal];
    [self.middleEightButton addTarget:self action:@selector(middleEightButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    [playImageView addSubview:self.middleEightButton];
    [self.middleEightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nineBallsButton.mas_bottom).offset(20 * scaleH);
        make.centerX.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(343 * scaleW, 125 * scaleH));
    }];
}

- (void)billaidButtonPressed {
    PlayDetailController *vc = [PlayDetailController new];
    vc.playTitle = @"斯诺克台球玩法";
    vc.playImage = @"siroke";
    vc.hidesBottomBarWhenPushed = true;
    [self.navigationController pushViewController:vc animated:true ];
}

- (void)nineBallsButtonPressed {
    PlayDetailController *vc = [PlayDetailController new];
    vc.playTitle = @"九球玩法";
    vc.playImage = @"jiuqiu";
    vc.hidesBottomBarWhenPushed = true;
    [self.navigationController pushViewController:vc animated:true ];
}

- (void)middleEightButtonPressed {
    PlayDetailController *vc = [PlayDetailController new];
    vc.playTitle = @"中八玩法";
    vc.playImage = @"zhongba";
    vc.hidesBottomBarWhenPushed = true;
    [self.navigationController pushViewController:vc animated:true ];
}

@end
